<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			*{
				margin: 0;
				padding: 0;
			}
			.div1{
				position: absolute;
				width: 200px;
				height: 200px;
				top: 50px;
				left: 10px;
				background: red;
			}
		</style>
	</head>
	<body>
		<button id="btn1">慢慢淡出</button>
		<button id="btn2">慢慢淡入</button>
		<button id="btn3">淡入/淡出切换</button>
		
		<div class="div1"></div>
		
		<script type="text/javascript" src="js/jquery-1.12.4.js" ></script>
		<script>
			/*			
			淡入淡出: 不改变元素透明度(opacity)来实现的
			1. fadeIn(): 带动画的显示
			2. fadeOut(): 带动画的隐藏
			3. fadeToggle(): 带动画切换显示/隐藏
			*/
			$(function(){
				$("#btn1").click(function(){
					$(".div1").fadeIn(function(){
						alert("动画完成了")
					})
				})
				$("#btn2").click(function(){
					$(".div1").fadeOut("slow")
				})
				$("#btn3").click(function(){
					$(".div1").fadeToggle(500)
				})
			})
		</script>
	</body>
</html>
